import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/index/login',
    method: 'post',
    data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}
export function getMenuByAdmin() {
  return request({
    url: '/user/menu-by-admin',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/index/logout',
    method: 'post'
  })
}

export function getManageList(query) {
  return request({
    url: '/user/list',
    method: 'get',
    params: query
  })
}

export function addManage(data) {
  return request({
    url: '/user/add',
    method: 'post',
    data
  })
}

export function updateManage(data) {
  return request({
    url: `/user/save`,
    method: 'post',
    data
  })
}

export function deleteManage(id) {
  return request({
    url: `/user/del`,
    method: 'delete',
    params: { id }
  })
}
